package com.heima.kafka.producer;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 消息提供方
 */
@RestController
public class TestController {

    @Autowired
    private KafkaTemplate<String,String> kafkaTemplate;

    @GetMapping("/sendMsg")
    public String sendMsg(String msg){
        /**
         * 1.队列的名字 （Topic）
         * 2.发送消息
         */
        kafkaTemplate.send("itheima-topic",msg);
        return "success";
    }
}
